package com.xiaolin.designmode.singleton;

/**
 * @ClassName SingletonTest
 * @Description TODO
 * @Detail detail
 * @Author MyPC
 * @Date 2020/10/29
 * @Version 1.0
 */
public class SingletonTest {
    public static void main(String[] args) {
//        EnumSingleton instance = EnumSingleton.getInstance();
//        System.out.println(instance);
        for(int i=0;i<1000;i++){
            SingletonThread singletonThread = new SingletonThread();
            singletonThread.start();
        }
    }
}

class SingletonThread extends Thread{
    @Override
    public void run() {
        try {
            Thread.sleep(10L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        InnerSingleton innerSingleton = InnerSingleton.innerSingleton();
        System.out.println(innerSingleton);
    }
}
